


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>(Optional) Building the liblept library &mdash; Leptonica &amp; Visual Studio 2008</title>
    <link rel="stylesheet" href="_static/leptonica.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.68',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/sidebar.js"></script>
    <link rel="top" title="Leptonica &amp; Visual Studio 2008" href="index.html" />
    <link rel="next" title="Visual Studio 2010 Notes" href="vs2010-notes.html" />
    <link rel="prev" title="(Optional) Building zlib, libjpeg, libpng, libtiff and giflib" href="building-image-libraries.html" />
 
    <link href='http://fonts.googleapis.com/css?family=Droid+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Droid+Sans:regular,bold' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
    <script type="text/javascript" src="http://www.google-analytics.com/urchin.js"></script>
    <script type="text/javascript" src="_static/sort-filter-table-compact.js"></script>
   


  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="vs2010-notes.html" title="Visual Studio 2010 Notes"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="building-image-libraries.html" title="(Optional) Building zlib, libjpeg, libpng, libtiff and giflib"
             accesskey="P">previous</a> |</li>
  <li><a href="http://www.leptonica.com">Leptonica Home</a> &raquo;</li>
  
        <li><a href="index.html">VS2008 Notes (for v1.68)</a> &raquo;</li>
 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="optional-building-the-liblept-library">
<span id="building-liblept"></span><h1>(Optional) Building the <span class="filesystem">liblept</span> library<a class="headerlink" href="#optional-building-the-liblept-library" title="Permalink to this headline">¶</a></h1>
<p>Assuming that you&#8217;ve <a class="reference internal" href="downloading-binaries.html"><em>downloaded</em></a> or
<a class="reference internal" href="building-image-libraries.html"><em>built</em></a> the requisite image libraries,
building <span class="filesystem">liblept</span> itself is straightforward since a Visual Studio
solution file is provided.</p>
<ol class="arabic">
<li><p class="first">Download the latest version of <strong>Leptonica</strong> from <a class="reference external" href="http://tpgit.github.com/UnOfficialLeptDocs/leptonica/source-downloads.html#leptonica">here</a>. Extract
the archive to the <span class="filesystem">BuildFolder</span> directory. You should now have:</p>
<pre class="literal-block">
BuildFolder\
  giflib-4.1.6\
  include\
  jpeg-8c\
  leptonica-1.68\
  lib\
  libtiff-3.9.4\
  lpng143\
  zlib\
</pre>
</li>
<li><p class="first">Download the Microsoft Visual Studio 2008 build package from <a class="reference external" href="http://tpgit.github.com/UnOfficialLeptDocs/leptonica/source-downloads.html#microsoft-visual-studio-2008">here</a>. Extract
the archive to the <span class="filesystem">BuildFolder\leptonica-</span><span class="filesystem">1.68</span>
directory. You should now have:</p>
<pre class="literal-block">
BuildFolder\
  giflib-4.1.6\
  include\
  jpeg-8c\
  leptonica-1.68\
    vs2008\
  lib\
  libtiff-3.9.4\
  lpng143\
  zlib\
</pre>
</li>
<li><p class="first"><span class="filesystem">leptprotos.h</span> has the wrong declaration for
<tt class="docutils literal"><span class="pre">setPixMemoryManager()</span></tt> under Windows. Change it from:</p>
<div class="highlight-none"><div class="highlight"><pre>LEPT_DLL extern void setPixMemoryManager ( void * ( allocator (size_t ) ), void  ( deallocator ( void * ) ) );
</pre></div>
</div>
<p>to:</p>
<div class="highlight-none"><div class="highlight"><pre>LEPT_DLL extern void setPixMemoryManager (void *((*allocator)(size_t)), void ((*deallocator)(void *)) );
</pre></div>
</div>
</li>
<li><p class="first">Copy all the <span class="filesystem">.h</span> header files from <span class="filesystem">leptonica-</span><span class="filesystem">1.68</span><span class="filesystem">\src</span>
to <span class="filesystem">BuildFolder\include\leptonica</span>.</p>
</li>
<li><p class="first">Open <span class="filesystem">BuildFolder\leptonica-</span><span class="filesystem">1.68</span><span class="filesystem">\vs2008\leptonica.sln</span> with Visual
Studio 2008.</p>
</li>
<li><p class="first">Select the desired build configuration (either <em class="guilabel">LIB Debug</em>,
<em class="guilabel">LIB Release</em>, <em class="guilabel">DLL Debug</em>, or <em class="guilabel">DLL
Release</em> and probably <em class="guilabel">Win32</em>).</p>
<p><em class="guilabel">LIB Debug</em> builds use the following C compiler options:</p>
<div class="highlight-none"><div class="highlight"><pre>/Od /I &quot;..\..\include&quot;
/D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_LIB&quot; /D &quot;L_LITTLE_ENDIAN&quot;
/D &quot;XMD_H&quot;
/FD /EHsc /RTC1 /MDd /Fo&quot;LIB Debug\\&quot; /Fd&quot;LIB Debug\vc90.pdb&quot;
/W3 /nologo /c /Z7 /errorReport:prompt
</pre></div>
</div>
<p><em class="guilabel">LIB Release</em> builds use the following C compiler options:</p>
<div class="highlight-none"><div class="highlight"><pre>/O2 /I &quot;..\..\include&quot;
/D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_LIB&quot; /D &quot;L_LITTLE_ENDIAN&quot;
/D &quot;XMD_H&quot; /D &quot;NO_CONSOLE_IO&quot;
/FD /EHsc /MD /Fo&quot;LIB Release\\&quot; /Fd&quot;LIB Release\vc90.pdb&quot;
/W3 /nologo /c /errorReport:prompt
</pre></div>
</div>
<p><em class="guilabel">DLL Debug</em> builds use the following C compiler options:</p>
<div class="highlight-none"><div class="highlight"><pre>/Od /I &quot;..\..\include&quot;
/D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_USRDLL&quot; /D &quot;_WINDLL&quot;
/D &quot;LIBLEPT_EXPORTS&quot; /D &quot;L_LITTLE_ENDIAN&quot;
/D &quot;XMD_H&quot;
/FD /EHsc /RTC1 /MDd /Fo&quot;DLL Debug\\&quot; /Fd&quot;DLL Debug\vc90.pdb&quot;
/W3 /nologo /c /Z7 /errorReport:prompt
</pre></div>
</div>
<p><em class="guilabel">DLL Release</em> builds use the following C compiler options:</p>
<div class="highlight-none"><div class="highlight"><pre>/O2 /I &quot;..\..\include&quot;
/D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_USRDLL&quot; /D &quot;_WINDLL&quot;
/D &quot;LIBLEPT_EXPORTS&quot; /D &quot;L_LITTLE_ENDIAN&quot;
/D &quot;XMD_H&quot; /D &quot;NO_CONSOLE_IO&quot;
/FD /EHsc /MD /Fo&quot;DLL Release\\&quot; /Fd&quot;DLL Release\vc90.pdb&quot;
/W3 /nologo /c /errorReport:prompt
</pre></div>
</div>
<p>All configurations turn off some warnings with the following
options:</p>
<div class="highlight-none"><div class="highlight"><pre>/wd4244 /wd4305 /wd4018 /wd4267 /wd4996
</pre></div>
</div>
<p><em class="guilabel">DLL</em> releases set the following linker options:</p>
<blockquote>
<div><pre class="literal-block">
/VERSION:1.68
</pre>
</div></blockquote>
</li>
<li><p class="first">Right-click <em class="guilabel">liblept</em><em class="guilabel">168</em> in the Solution Explorer and
Choose <em class="menuselection">B<span class="accelerator">u</span>ild</em> or <em class="menuselection">R<span class="accelerator">e</span>build</em> from the
context menu (Choosing <em class="menuselection"><span class="accelerator">B</span>uild ‣ <span class="accelerator">B</span>uild Solution</em>
(<tt class="kbd docutils literal"><span class="pre">F6</span></tt>) or <em class="menuselection"><span class="accelerator">B</span>uild ‣ <span class="accelerator">R</span>ebuild Solution</em> from the
Visual Studio menubar will result in <span class="filesystem">ioformats_reg</span> also being
built). The resultant library will automatically be copied to
<span class="filesystem">BuildFolder\lib</span>.</p>
<p>The libraries are named as follows:</p>
<table border="1" class="docutils">
<colgroup>
<col width="18%" />
<col width="41%" />
<col width="40%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">&nbsp;</th>
<th class="head"><p class="first last">Debug Builds</p>
</th>
<th class="head"><p class="first last">Release Builds</p>
</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last">Static library</p>
</td>
<td><p class="first last">liblept168-static-mtdll-debug.lib</p>
</td>
<td><p class="first last">liblept168-static-mtdll.lib</p>
</td>
</tr>
<tr><td><p class="first last">DLL</p>
</td>
<td><div class="first last line-block">
<div class="line">liblept168d.lib (import library)</div>
<div class="line">liblept168d.dll</div>
</div>
</td>
<td><div class="first last line-block">
<div class="line">liblept168.lib (import library)</div>
<div class="line">liblept168.dll</div>
</div>
</td>
</tr>
</tbody>
</table>
</li>
</ol>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div style="text-align: center; padding-right: 5px;">
 <a href="http://www.leptonica.com" >
  <img src="_static/moller52-smaller.jpg" border="0" alt="Leptonica Home"/>
 </a>
</div>



<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="downloading-binaries.html">Downloading <span class="filesystem">liblept</span> pre-built binaries and header files for Windows</a></li>
<li class="toctree-l1"><a class="reference internal" href="building-other-programs.html">Building programs that link with <span class="filesystem">liblept</span></a></li>
<li class="toctree-l1"><a class="reference internal" href="directory-organization.html">Directory organization</a></li>
<li class="toctree-l1"><a class="reference internal" href="vs2008-solution.html">The <span class="filesystem">liblept</span> Visual Studio 2008 Solution</a></li>
<li class="toctree-l1"><a class="reference internal" href="building-prog-dir.html">Building the <span class="filesystem">prog</span> directory programs</a></li>
<li class="toctree-l1"><a class="reference internal" href="installing-cygwin.html">Installing Cygwin coreutils</a></li>
<li class="toctree-l1"><a class="reference internal" href="installing-irfanview.html">Installing IrfanView to view images</a></li>
<li class="toctree-l1"><a class="reference internal" href="installing-gnuplot.html">Installing gnuplot to view plots</a></li>
<li class="toctree-l1"><a class="reference internal" href="csharp-and-liblept.html">c# and <span class="filesystem">liblept</span></a></li>
<li class="toctree-l1"><a class="reference internal" href="building-image-libraries.html">(Optional) Building <span class="filesystem">zlib</span>, <span class="filesystem">libjpeg</span>, <span class="filesystem">libpng</span>, <span class="filesystem">libtiff</span> and <span class="filesystem">giflib</span></a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">(Optional) Building the <span class="filesystem">liblept</span> library</a></li>
<li class="toctree-l1"><a class="reference internal" href="vs2010-notes.html">Visual Studio 2010 Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="package-contents.html">Package Contents</a></li>
<li class="toctree-l1"><a class="reference internal" href="versions.html">Version Notes</a></li>
</ul>


<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="vs2010-notes.html" title="Visual Studio 2010 Notes"
             >next</a></li>
        <li class="right" >
          <a href="building-image-libraries.html" title="(Optional) Building zlib, libjpeg, libpng, libtiff and giflib"
             >previous</a> |</li>
  <li><a href="http://www.leptonica.com">Leptonica Home</a> &raquo;</li>
  
        <li><a href="index.html">VS2008 Notes (for v1.68)</a> &raquo;</li>
 
      </ul>
    </div>
  <div class="footer">

   <span class="creativecommons">
    <a href="http://creativecommons.org/licenses/by/3.0/us/" >
      <img src="_static/creativecommons-88x31.png"
	   border="0" alt="Creative Commons License"/>
     </a>
    Leptonica by 
    <a href="http://leptonica.com/www.leptonica.org">
    Dan Bloomberg
    </a>
    is licensed under a
    <a href="http://creativecommons.org/licenses/by/3.0/us/">
     Creative Commons Attribution 3.0 United States License.
    </a>
   </span>

   
   <span class="sphinxcreditr">
   Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
   </span>
   

    <script type="text/javascript">
      _uacct = "UA-144810-1";
      urchinTracker();
    </script>
  </div>
  </body>
</html>